<?php
/**
 * @auther:周卫星
 * @date:2019/10/31
 * @fileName:index.blade.php
 * @fileDesc: 餐台列表
 */
?>

@extends('biz.layout.biz_layout')
@section('title', '餐台管理-餐台列表')
@push('css')
    <style>
        .table_list{height: 100px; border: 1px solid #ddd; text-align: center; margin-left: 10px;margin-bottom: 10px;line-height: 100px;cursor: pointer;display: inline-block;border-radius: 4px;box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.4);}
        .table-grid-title {
            height: 120px;
            width: 120px;
            line-height: 120px;
            text-align: center;
        }
    </style>
    <link rel="stylesheet" href="{{ Illuminate\Support\Facades\URL::asset('css/biz/table/index.css') }}">
@endpush

@push('js')
    <script src="{{ Illuminate\Support\Facades\URL::asset('js/biz/table/index.js') }}"></script>
@endpush

@section('content')
    <div class="layui-btn-container">
        <button class="layui-btn" id="addBtn">添加餐台</button>
    </div>
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">全部</li>
            @foreach($region as $key => $value)
            <li>{{ $value['name'] }}</li>
            @endforeach
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-row">
                    @foreach($table as $key => $value)
                        <div class="layui-col-xs1 layui-col-sm1 layui-col-md1 layui-col-lg1 table_list">
                            <h2>{{ $value['name'] }}</h2>
                            <ul class="layui-clear url" style="position: absolute;top:100px;z-index: 1; background-color:#1e9fff; width: 100%; height: 30px; line-height: 30px;">
                                <li class="hover_list hover_boder" data-id="{{ $value['id'] }}">编辑</li>
                                <li class="hover_list" onclick="del('{{ $value['id'] }}')">删除</li>
                            </ul>
                            <div class="table_qrcode">
                                {!! QrCode::size(100) -> generate("http://m.sysdcw.com/#/".$value['id']); !!}
                            </div>
                        </div>
                    @endforeach
                </div>
            </div>
            @foreach($table_region as $key => $value)
                <div class="layui-tab-item">
                    @foreach($value as $k => $v)
                        <div class="layui-col-xs1 layui-col-sm1 layui-col-md1 layui-col-lg1 table_list">
                            <h2 class="table-grid-title">{{ $v['name'] }}</h2>
                            <ul class="layui-clear url" style="position: absolute;top:100px;z-index: 1; background-color:#1e9fff; width: 100%; height: 30px; line-height: 30px;">
                                <li class="hover_list hover_boder" data-id="{{ $v['id'] }}">编辑</li>
                                <li class="hover_list" onclick="del('{{ $v['id'] }}')">删除</li>
                            </ul>
                            <div class="table_qrcode">
                                {!! QrCode::size(100)->generate("http://m.sysdcw.com/#/".$v['id']); !!}
                            </div>
                        </div>
                    @endforeach
                </div>
            @endforeach
        </div>
    </div>

    <div style="display: none;" class="layui-fluid" id="addRegion">
        <form class="layui-form" id="regionAdd" action="" lay-filter="regionAdd">
            <input type="hidden" value="{{ csrf_token() }}" name="_token">
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block">
                    <input type="text" name="table_name" required  lay-verify="required" placeholder="请输入餐台名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">区域</label>
                <div class="layui-input-block">
                    <select name="region_id" lay-verify="required">
                        <option value=""></option>
                        @foreach($region as $key => $value)
                        <option value="{{ $value['id'] }}">{{ $value['name'] }}</option>
                            @endforeach
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">排序</label>
                <div class="layui-input-block">
                    <input type="number" name="region_sort" required lay-verify="required" placeholder="排序" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">容量</label>
                <div class="layui-input-block">
                    <input type="number" name="region_capacity" required lay-verify="required" placeholder="请输入餐台容量" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">最低消费</label>
                <div class="layui-input-block">
                    <input type="text" name="region_min" required lay-verify="required" placeholder="最低消费" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <textarea name="desc" placeholder="请输入备注" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="addForm">添加</button>
                </div>
            </div>
        </form>
    </div>


    <div style="display: none;" class="layui-fluid" id="editTable">
        <form class="layui-form" id="editTableInfo" action="" lay-filter="tableInfo">
            <input type="hidden" value="{{ csrf_token() }}" name="_token">
            <input type="hidden" name="id" value="">
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block">
                    <input type="text" name="table_name" required  lay-verify="required" placeholder="请输入餐台名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">区域</label>
                <div class="layui-input-block">
                    <select name="region_id" lay-verify="required">
                        <option value=""></option>
                        @foreach($region as $key => $value)
                            <option value="{{ $value['id'] }}">{{ $value['name'] }}</option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">排序</label>
                <div class="layui-input-block">
                    <input type="number" name="region_sort" required lay-verify="required" placeholder="排序" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">容量</label>
                <div class="layui-input-block">
                    <input type="number" name="region_capacity" required lay-verify="required" placeholder="请输入餐台容量" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">最低消费</label>
                <div class="layui-input-block">
                    <input type="text" name="region_min" required lay-verify="required" placeholder="最低消费" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <textarea name="desc" placeholder="请输入备注" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="editForm">修改</button>
                </div>
            </div>
        </form>
    </div>

@endsection
